import Vue from 'vue'
import Router from 'vue-router'
import WXLogin from './views/Home/WXLogin.vue' //登录
import Index from './views/Home/Index.vue'; //vip首页
import Home from './views/Home/Home.vue' //主页
import Category from './views/Shop/Category.vue' //分类页
import Cart from './views/Shop/Cart.vue' // 购物车
import Goods from './views/Shop/Goods.vue' //商品详情
import VipGoods from './views/Shop/VipGoods.vue' //vip商品详情
import Pickup from './views/Shop/Pickup.vue'    //提货链接
import PickupConfirm from './views/User/PickupConfirm.vue'    //确认提货
import Upgrade from './views/Shop/Upgrade.vue'    //代理升级
import UpgradeGoods from './views/Shop/UpgradeGoods.vue'    //代理升级
import UpgradeConfirm from './views/User/UpgradeConfirm.vue'    //代理升级
import Replenish from './views/Shop/Replenish.vue'    //代理补货
import ReplenishGoods from './views/Shop/ReplenishGoods.vue'    //代理补货详情
import ReplenishConfirm from './views/User/ReplenishConfirm.vue'    //确认补货


import Register from './views/User/Register.vue' //注册
import Login from './views/User/Login.vue' //登录
import User from './views/User/User.vue' // 我的
import Vip from './views/User/Vip.vue'    //vip个人中心
import UserAddress from './views/User/UserAddress.vue' //地址列表
import AddressEdit from './views/User/AddressEdit.vue' //地址编辑
import AddressAdd from './views/User/AddressAdd.vue' //增加地址
import AddressList from './views/User/AddressList.vue'
// import UserBalance from './views/User/UserBalance.vue'

import Team from './views/User/Team.vue'
import MemberOrder from './views/User/MemberOrder.vue'
import LevelOrder from './views/User/LevelOrder.vue'
import Order from './views/User/Order.vue'
import VipOrder from './views/User/VipOrder.vue'
import Forget from './views/User/Forget.vue' //忘记密码
import MsgList from './views/User/MsgList.vue' //消息列表
import MsgDetail from './views/User/MsgDetail.vue' //消息详情
import Setting from './views/User/Setting.vue' //设置
import Profile from './views/User/Profile.vue' //我的资料
import Phonechange from './views/User/Phonechange.vue' //修改手机号
import PwdChange from './views/User/PwdChange.vue' //修改密码
import NicknameChange from './views/User/NicknameChange.vue' //修改昵称
import About from './views/User/About.vue' //关于我们
import Help from './views/User/Help.vue' //帮助反馈
import QDetail from './views/User/QDetail.vue' //问题详情

import GoodsList from './views/User/GoodsList.vue' //商品列表
import Search from './views/User/Search.vue'  //搜索列表
import Collection from './views/User/Collection.vue'  //我的收藏
import Publish from './views/User/Publish.vue'    //发表评价
import Logistics from './views/User/Logistics.vue'    //物流详情
import OrderDetail from './views/User/OrderDetail.vue'    //订单详情
import OrderConfirm from './views/User/OrderConfirm.vue'    //确认订单
import VipConfirm from './views/User/VipConfirm.vue'    //vip确认订单
import PayType from './views/User/PayType.vue'    //支付


import OfflineDetail from './views/User/OfflineDetail.vue'    //线下付款详情
import Invite from './views/User/Invite.vue'    //邀请码
import BankcardList from './views/User/BankcardList.vue'    //银行卡添加
import BankcardAdd from './views/User/BankcardAdd.vue'    //银行卡添加
import Withdraw from './views/User/Withdraw.vue'    //提现
import WithdrawRecord from './views/User/WithdrawRecord.vue'    //提现记录
import EarningRecord from "./views/User/EarningRecord.vue";
import EarningsRecord from "./views/User/EarningsRecord.vue"
import IntegralRecord from "./views/User/IntegralRecord.vue"
import StockRecord from "./views/User/StockRecord.vue"
import PaymentCode from "./views/User/PaymentCode"
import CreationOrderConfirm from "./views/User/CreationOrderConfirm.vue"
import LevelOrderConfirm from "./views/User/LevelOrderConfirm.vue"
import UpgradeOrderConfirm from "./views/User/UpgradeOrderConfirm.vue"
import alipay from "./views/User/alipay.vue"
import OnlinePay from "./views/User/OnlinePay.vue";
import TeamAchievement from "./views/User/TeamAchievement";

import Member from "./views/User/Member";
import MemberDetail from "./views/User/MemberDetail";
import MemberInventory from "./views/User/MemberInventory";
import TurnTable from "./views/User/TurnTable";

Vue.use(Router)

const router = new Router({
    routes: [
        // {
        //   path: '/',
        //   name: 'wxlogin',
        //   component: WXLogin,
        //   meta: {
        //     navShow: false,
        //   }
        // },
        {
            path: '/',
            name: 'index',
            component: Index,
            meta: {
                navShow: false,
                keepAlive: true,
            }
        },
        {
            path: '/home',
            name: 'home',
            component: Home,
            meta: {
                navShow: true,
                keepAlive: true,
            }
        },
        {
            path: '/category',
            name: 'category',
            component: Category,
            meta: {
                navShow: true,
            }
        },

        {
            path: '/cart',
            name: 'cart',
            component: Cart,
            meta: {
                navShow: true,
            }
        },
        {
            path: '/goods',
            name: 'goods',
            component: Goods,
        },
        {
            path: '/vipgoods',
            name: 'vipgoods',
            component: VipGoods,
        },
        {
            path: '/upgrade',
            name: 'upgrade',
            component: Upgrade,
        },
        {
            path: '/teamAchievement',
            name: 'teamAchievement',
            component: TeamAchievement,
        },
        {
            path: '/OnlinePay',
            name: 'OnlinePay',
            component: OnlinePay,
        },
        {
            path: '/upgradegoods',
            name: 'upgradegoods',
            component: UpgradeGoods,
        },
        {
            path: '/upgradeconfirm',
            name: 'upgradeconfirm',
            component: UpgradeConfirm,
        },
        {
            path: '/replenish',
            name: 'replenish',
            component: Replenish,
        },
        {
            path: '/replenishgoods',
            name: 'replenishgoods',
            component: ReplenishGoods,
        },
        {
            path: '/replenishconfirm',
            name: 'replenishconfirm',
            component: ReplenishConfirm,
        },
        {
            path: '/creationorderconfirm',
            name: 'creationorderconfirm',
            component: CreationOrderConfirm,
        },
        {
            path: '/levelorderconfirm',
            name: 'levelorderconfirm',
            component: LevelOrderConfirm,
        },
        {
            path: '/upgradeorderconfirm',
            name: 'upgradeorderconfirm',
            component: UpgradeOrderConfirm,
        },
        {
            path: '/pickup',
            name: 'pickup',
            component: Pickup,
        },
        {
            path: '/pickupconfirm',
            name: 'pickupconfirm',
            component: PickupConfirm,
        },
        {
            path: '/register',
            name: 'register',
            component: Register,
            meta: {
                navShow: false,
            }
        },
        {
            path: '/login',
            name: 'login',
            component: Login,
            meta: {
                navShow: false
            }
        },
        {
            path: '/forget',
            name: 'forget',
            component: Forget,
            meta: {
                navShow: false
            }
        },
        {
            path: '/user',
            name: 'user',
            component: User,
            meta: {
                navShow: true,
                keepAlive: true,
            },
        },
        {
            path: '/vip',
            name: 'vip',
            component: Vip,
            // meta: {
            //   keepAlive: true,
            // },
        },
        {
            path: '/team',
            name: 'team',
            component: Team,
            meta: {
                keepAlive: true,
            },
        },
        {
            path: '/memberorder',
            name: 'memberorder',
            component: MemberOrder,
            meta: {
                navShow: false,
            },
        },
        {
            path: '/levelorder',
            name: 'levelorder',
            component: LevelOrder,
            meta: {
                navShow: false,
            },
        },
        {
            path: '/order',
            name: 'order',
            component: Order,
            meta: {
                navShow: false,
            },
        },
        {
            path: '/viporder',
            name: 'viporder',
            component: VipOrder,
            meta: {
                navShow: false,
            },
        },
        {
            path: '/msglist',
            name: 'msglist',
            component: MsgList,
            meta: {
                navShow: false
            }
        },
        {
            path: '/msgdetail',
            name: 'msgdetail',
            component: MsgDetail,
            meta: {
                navShow: false
            }
        },
        {
            path: '/setting',
            name: 'setting',
            component: Setting,
            meta: {
                navShow: false
            }
        },
        {
            path: '/profile',
            name: 'profile',
            component: Profile,
            meta: {
                navShow: false
            }
        },
        {
            path: '/phonechange',
            name: 'phonechange',
            component: Phonechange,
            meta: {
                navShow: false
            }
        },
        {
            path: '/pwdchange',
            name: 'pwdchange',
            component: PwdChange,
            meta: {
                navShow: false
            }
        },
        {
            path: '/nicknamechange',
            name: 'nicknamechange',
            component: NicknameChange,
            meta: {
                navShow: false
            }
        },
        {
            path: '/about',
            name: 'about',
            component: About,
            meta: {
                navShow: false,
                keepAlive: true
            }
        },
        {
            path: '/help',
            name: 'help',
            component: Help,
            meta: {
                navShow: false
            }
        },
        {
            path: '/qdetail',
            name: 'qdetail',
            component: QDetail,
            meta: {
                navShow: false
            }
        },
        {
            path: '/useraddress',
            name: 'useraddress',
            component: UserAddress,
            meta: {
                navShow: false
            }
        },
        {
            path: '/addressedit',
            name: 'addressedit',
            component: AddressEdit,
            meta: {
                navShow: false
            }
        },
        {
            path: '/addressadd',
            name: 'addressadd',
            component: AddressAdd,
            meta: {
                navShow: false
            }
        },
        {
            path: '/addresslist',
            name: 'addresslist',
            component: AddressList,
            meta: {
                navShow: false
            }
        },
        {
            path: '/goodslist',
            name: 'goodslist',
            component: GoodsList,
            meta: {
                navShow: false
            }
        },
        {
            path: '/search',
            name: 'search',
            component: Search,
            meta: {
                navShow: false
            }
        },
        {
            path: '/collection',
            name: 'collection',
            component: Collection,
            meta: {
                navShow: false
            }
        },
        {
            path: '/publish',
            name: 'publish',
            component: Publish,
            meta: {
                navShow: false
            }
        },
        {
            path: '/logistics',
            name: 'logistics',
            component: Logistics,
            meta: {
                navShow: false
            }
        },
        {
            path: '/orderdetail',
            name: 'orderdetail',
            component: OrderDetail,
            meta: {
                navShow: false
            }
        },
        {
            path: '/orderconfirm',
            name: 'orderconfirm',
            component: OrderConfirm,
            meta: {
                navShow: false
            }
        },
        {
            path: '/vipconfirm',
            name: 'vipconfirm',
            component: VipConfirm,
            meta: {
                navShow: false
            }
        },
        {
            path: '/paytype',
            name: 'paytype',
            component: PayType,
            meta: {
                navShow: false
            }
        },
        {
            path: '/offlinedetail',
            name: 'offlinedetail',
            component: OfflineDetail,
            meta: {
                navShow: false
            }
        },
        {
            path: '/invite',
            name: 'invite',
            component: Invite,
            meta: {
                navShow: false
            }
        },
        {
            path: '/bankcardlist',
            name: 'bankcardlist',
            component: BankcardList,
            meta: {
                navShow: false
            }
        },
        {
            path: '/bankcardadd',
            name: 'bankcardadd',
            component: BankcardAdd,
            meta: {
                navShow: false
            }
        },
        {
            path: '/withdraw',
            name: 'withdraw',
            component: Withdraw,
            meta: {
                navShow: false
            }
        },
        {
            path: '/withdrawrecord',
            name: 'withdrawrecord',
            component: WithdrawRecord,
            meta: {
                navShow: false
            }
        },
        {
            path: '/IntegralRecord',
            name: 'integralrecord',
            component: IntegralRecord,
            meta: {
                navShow: false
            }
        },
        {
            path: '/EarningsRecord',
            name: 'earningsrecord',
            component: EarningsRecord,
            meta: {
                navShow: false
            }
        },
        {
            path: '/stockrecord',
            name: 'stockrecord',
            component: StockRecord,
            meta: {
                navShow: false
            }
        },
        {
            path: '/paymentcode',
            name: 'paymentcode',
            component: PaymentCode,
            meta: {
                navShow: false
            }
        },
        {
            path: '/alipay',
            name: 'alipay',
            component: alipay,
            meta: {
                navShow: false
            }
        },
        {
            path: '/member',
            name: 'member',
            component: Member,
            meta: {
                navShow: false
            }
        },
        {
            path: '/memberdetail',
            name: 'memberdetail',
            component: MemberDetail,
            meta: {
                navShow: false
            }
        },
        {
            path: '/memberinventory',
            name: 'memberinventory',
            component: MemberInventory,
            meta: {
                navShow: false
            }
        },
        {
            path: '/turntable',
            name: 'turntable',
            component: TurnTable,
            meta: {
                navShow: false
            }
        },
        
    ],
    mode: 'hash',
})

//路由守卫
// router.beforeEach((to, from, next) => {
//   const isLogin = localStorage.loginToken ? true : false;
//   if (to.path === '/login' || to.path === '/register') {
//     next();
//   } else {
//     isLogin ? next() : next('/login');
//   }
// })
export default router;
